home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 428_02 / libsrc / getaltky.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-13  |  718 b   |  32 lines

  1. /*
  2. ** getaltky.c
  3. **
  4. ** Pictor, Version 1.51, Copyright (c) 1992-94 SoftCircuits
  5. ** Redistributed by permission.
  6. */
  7.  
  8. #include <ctype.h>
  9. #include "pictor.h"
  10.  
  11. static int table[] = {
  12.     ALT_0,ALT_1,ALT_2,ALT_3,ALT_4,ALT_5,ALT_6,ALT_7,ALT_8,ALT_9,
  13.     0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  14.     ALT_A,ALT_B,ALT_C,ALT_D,ALT_E,ALT_F,ALT_G,ALT_H,ALT_I,
  15.     ALT_J,ALT_K,ALT_L,ALT_M,ALT_N,ALT_O,ALT_P,ALT_Q,ALT_R,
  16.     ALT_S,ALT_T,ALT_U,ALT_V,ALT_W,ALT_X,ALT_Y,ALT_Z
  17. };
  18.  
  19.  
  20. /*
  21. ** Converts c to its equivelent alt-key combination code if c
  22. ** is alpha-numeric, otherwise 0 is returned.
  23. */
  24. int getaltkey(int c)
  25. {
  26.     if(isalnum(c & 0xFF))
  27.         return(table[toupper(c & 0xFF) - '0']);
  28.     else
  29.         return(0x00);
  30.  
  31. } /* getaltkey */
  32.